#ifndef COLLISION_FLAGS_H
#define COLLISION_FLAGS_H
class CollisionFlags
{
public:
    CollisionFlags() {flags = 0;};
    ~CollisionFlags() {};

    enum COLLISION_FLAGS
    {
        NO_GRAVITY=1,
        NO_PHYSICS=2,
        NO_CHECK_X=4,
        NO_CHECK_Y=8,
        NO_UNITS=16,
        USE_RECT=32
    };

    int flags;

    /// All of the following function also work with multiple (combined) flags passed as "var"
    // Checks whether the passed flag is in flags
    bool hasFlag(const int &var) const
    {
        return ((flags & var) == var);
    };

    // Adds a flag to flags
    void addFlag(const int &var)
    {
        flags = (flags | var);
    };

    // Removes a flag from var (making sure it was actually present)
    void removeFlag(const int &var)
    {
        flags = (flags ^ (flags & var));
    };

    static int stringToFlag(const string &ident)
    {
        if (ident == "NO_GRAVITY")
            return NO_GRAVITY;
        else if (ident == "NO_PHYSICS")
            return NO_PHYSICS;
        else if (ident == "NO_CHECK_X")
            return NO_CHECK_X;
        else if (ident == "NO_CHECK_Y")
            return NO_CHECK_Y;
        else if (ident == "NO_UNITS")
            return NO_UNITS;
        else if (ident == "USE_RECT")
            return USE_RECT;
        else
            return 0;
    }
};
#endif //COLLISION_FLAGS_H
